package com.RMP
{
    import flash.display.*;
    import flash.events.*;
    import com.greensock.*;

    public class BookmarksIcons extends Sprite
    {
        var fadeSpeed:Number;
        public var hover:Boolean = false;
        public var hoverRight:Boolean = false;
        var arrowR:Sprite;
        var arrowL:Sprite;
        var minus:Sprite;
        var btnM:Sprite;
        public var btnR:Sprite;
        public var btnL:Sprite;
        public var hoverLeft:Boolean = false;
        public var hoverMinus:Boolean = false;
        var myRoot:MovieClip;

        public function BookmarksIcons(param1:MovieClip, param2:Number) : void
        {
            hover = false;
            hoverMinus = false;
            hoverLeft = false;
            hoverRight = false;
            myRoot = param1;
            fadeSpeed = param2;
            btnM = new Sprite();
            btnM.graphics.beginFill(16777215, 0);
            btnM.graphics.drawRect(0, 0, 15, 23);
            btnM.graphics.endFill();
            btnM.graphics.beginFill(16777215, 1);
            btnM.graphics.drawRect(0, 0, 15, 13);
            btnM.graphics.endFill();
            btnM.buttonMode = true;
            btnM.name = "btnM";
            btnM.addEventListener(MouseEvent.MOUSE_OVER, btnMOver);
            btnM.addEventListener(MouseEvent.MOUSE_OUT, btnMOut);
            btnM.addEventListener(MouseEvent.CLICK, btnMClick);
            addChild(btnM);
            minus = new Sprite();
            minus.graphics.beginFill(7829367, 1);
            minus.graphics.drawRect(0, 4, 10, 2);
            minus.graphics.endFill();
            btnM.addChild(minus);
            btnL = new Sprite();
            btnL.graphics.beginFill(16777215, 0);
            btnL.graphics.drawRect(0, 0, 15, 23);
            btnL.graphics.endFill();
            btnL.graphics.beginFill(16777215, 1);
            btnL.graphics.drawRect(0, 0, 15, 13);
            btnL.graphics.endFill();
            btnL.buttonMode = true;
            btnL.name = "btnL";
            btnL.addEventListener(MouseEvent.MOUSE_OVER, btnLOver);
            btnL.addEventListener(MouseEvent.MOUSE_OUT, btnLOut);
            btnL.addEventListener(MouseEvent.CLICK, btnLClick);
            addChild(btnL);
            arrowL = new Sprite();
            arrowL.graphics.beginFill(7829367, 1);
            arrowL.graphics.drawRect(5, 4, 1, 1);
            arrowL.graphics.drawRect(6, 3, 1, 3);
            arrowL.graphics.drawRect(7, 2, 1, 5);
            arrowL.graphics.drawRect(8, 1, 1, 7);
            arrowL.graphics.drawRect(9, 0, 1, 9);
            arrowL.graphics.endFill();
            btnL.addChild(arrowL);
            btnL.x = 15;
            btnR = new Sprite();
            btnR.graphics.beginFill(16777215, 0);
            btnR.graphics.drawRect(0, 0, 28, 23);
            btnR.graphics.endFill();
            btnR.graphics.beginFill(16777215, 1);
            btnR.graphics.drawRect(0, 0, 18, 13);
            btnR.graphics.endFill();
            btnR.buttonMode = true;
            btnR.name = "btnR";
            btnR.addEventListener(MouseEvent.MOUSE_OVER, btnROver);
            btnR.addEventListener(MouseEvent.MOUSE_OUT, btnROut);
            btnR.addEventListener(MouseEvent.CLICK, btnRClick);
            addChild(btnR);
            arrowR = new Sprite();
            arrowR.graphics.beginFill(7829367, 1);
            arrowR.graphics.drawRect(4, 0, 1, 9);
            arrowR.graphics.drawRect(5, 1, 1, 7);
            arrowR.graphics.drawRect(6, 2, 1, 5);
            arrowR.graphics.drawRect(7, 3, 1, 3);
            arrowR.graphics.drawRect(8, 4, 1, 1);
            arrowR.graphics.endFill();
            btnR.addChild(arrowR);
            btnR.x = 30;
            return;
        }

        function btnROut(event:MouseEvent)
        {
            hover = false;
            hoverRight = false;
            TweenMax.to(arrowR, fadeSpeed, {alpha:1, tint:myRoot.coldColor, overwrite:true});
            myRoot.hideToolTip();
            return;
        }

        function btnMOut(event:MouseEvent)
        {
            hover = false;
            hoverMinus = false;
            TweenMax.to(minus, fadeSpeed, {alpha:1, tint:myRoot.coldColor, overwrite:true});
            myRoot.hideToolTip();
            return;
        }

        function btnLOver(event:MouseEvent)
        {
            myRoot.changeToolTipText("Move Backward");
            hover = true;
            hoverLeft = true;
            TweenMax.to(arrowL, fadeSpeed, {alpha:1, tint:myRoot.hotColor, overwrite:true});
            myRoot.showToolTip();
            return;
        }

        function btnROver(event:MouseEvent)
        {
            myRoot.changeToolTipText("Move Forward");
            hover = true;
            hoverRight = true;
            TweenMax.to(arrowR, fadeSpeed, {alpha:1, tint:myRoot.hotColor, overwrite:true});
            myRoot.showToolTip();
            return;
        }

        function btnMClick(event:MouseEvent)
        {
            myRoot.closeToolTip();
            return;
        }

        function btnRClick(event:MouseEvent)
        {
            myRoot.closeToolTip();
            return;
        }

        function btnLOut(event:MouseEvent)
        {
            hover = false;
            hoverLeft = false;
            TweenMax.to(arrowL, fadeSpeed, {alpha:1, tint:myRoot.coldColor, overwrite:true});
            myRoot.hideToolTip();
            return;
        }

        function btnMOver(event:MouseEvent)
        {
            myRoot.changeToolTipText("Remove Bookmark");
            hover = true;
            hoverMinus = true;
            TweenMax.to(minus, fadeSpeed, {alpha:1, tint:myRoot.hotColor, overwrite:true});
            myRoot.showToolTip();
            return;
        }

        function btnLClick(event:MouseEvent)
        {
            myRoot.closeToolTip();
            return;
        }

    }
}
